package com.xu.cloud.auth.controller;

import com.xu.cloud.auth.service.LogoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 退出登录controller
 *
 * @author xuguan
 * @since 2025/2/27
 */
@RestController
@RequestMapping("/api/logout/v1")
@Validated
public class LogoutController {

    @Autowired
    private LogoutService logoutService;

    /**
     * 退出登录
     */
    @PostMapping("/deleteAccessToken")
    public void logout(@RequestHeader(HttpHeaders.AUTHORIZATION) String accessToken) {
        logoutService.logout(accessToken);
    }

}
